<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="zh-CN">
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    <title>OSC Open API</title>
    <style type="text/css">
        .left{float: left;width: 200px;background-color: #F3F3F3;}
        .right{float: left;width: 800px;height: 1000px;margin-left: 20px;}
        .title{background-color: #EDF3F9;padding-left: 20px;margin: 10px 0px;font-weight: bold;font-size: 14px;}
        .context{padding-left: 20px;font-size: 12px;}
        .example{border: 1px dashed black;padding-left: 30px;background-color: #f9f9f9;font-size: 12px;overflow: hidden;line-height: 1.1em;}
        .search_text{float: left;width: 150px;}
        .search_btn{float: left}
        .returnType{font-weight: bold;font-size: 12px;padding-left: 30px;}
        .url{font-weight: bold;}
        .clear{clear: both;}
        .return{font-size: 12px;}
    </style>
    <script type="text/javascript" src="./js/jquery.js"></script>
    <script type="text/javascript" src="./js/baidutemplate.js"></script>

    <script type="text/html" id="json">
{
    "post_list": [
        {
            "id": 82977, 
            "author": "彭博", 
            "pubDate": "2012-12-18 16:20:08.0", 
            "title": "测试youku视频地址", 
            "answerCount": 0, 
            "authorid": 89964, 
            "answer": "", 
            "portrait": "http://static.oschina.net/uploads/user/44/89964_50.jpg?t=1376365607000", 
            "viewCount": 12
        }, 
        {
            "id": 83123, 
            "author": "彭博", 
            "pubDate": "2013-05-24 10:34:40.0", 
            "title": "测试站外活动", 
            "answerCount": 0, 
            "authorid": 89964, 
            "answer": "", 
            "portrait": "http://static.oschina.net/uploads/user/44/89964_50.jpg?t=1376365607000", 
            "viewCount": 0
        }
    ], 
    "notice": {
        "replyCount": 0, 
        "msgCount": 0, 
        "fansCount": 0, 
        "referCount": 0
    }
}
    </script>
    <script type="text/javascript">
        var data = {
            api:'/action/openapi/active_list',
            api_desc:'获取动态列表',
            url:'/action/openapi/active_list',
            dataType:'JSON JSONP XML',
            reqType:'GET/POST',
            require_login: '是',
            access_auth: 'password',
            req_param: [
                {name:'access_token',must: false,type_range:'string',desc:'oauth2_token获取的access_token catalog为4时不需要认证 其他都需要 否则提示失败',default:''},
                {name:'catalog',must: false,type_range:'int',desc:'类别ID [ 0、1所有动态,2提到我的,3评论,4我自己 ]',default:'0'},
                {name:'user',must: true,type_range:'int',desc:'用户ID',default:'0'},
                {name:'pageSize',must: false,type_range:'int',desc:'每页条数',default:'20'},
                {name:'page/pageIndex',must: false,type_range:'int',desc:'页数',default:'1'},
                {name:'dataType',must: true,type_range:'string',desc:'返回数据类型[\'json\'|\'jsonp\'|\'xml\']',default:'json'}
            ],
            tip:'',
            resultType: 'JSON',
            ret_param: [
                {name:'activelist.id',type_range:'int',desc:'动态ID'},
                {name:'activelist.portrait',type_range:'string',desc:'发布者用户头像地址'},
                {name:'activelist.author',type_range:'string',desc:'发布者'},
                {name:'activelist.authorid',type_range:'long',desc:'发布者ID'},
                {name:'activelist.catalog',type_range:'int',desc:'动态分类：1-新闻、2-问答区（发布帖子、回复帖子）、3-动弹、4-博客（发博客，评论）、0-其他'},
                {name:'activelist.appClient',type_range:'int',desc:'客户端类型：1-WEB、2-WAP、3-Android、4-IOS、5-WP'},
                {name:'activelist.objectId',type_range:'long',desc:'动态对象id：动弹 帖子 博客ID (根据objectType区分)'},
                {name:'activelist.objectType',type_range:'int',desc:'动态类型：1-开源软件、2-帖子、3-博客、4-新闻、5-代码、6-职位、7-翻译文章、8-翻译段落、16-新闻评论、17-讨论区答案、18-博客评论、19-代码评论、20-职位评论、21-翻译评论、32-职位评论、100-动弹、101-动弹回复'},
                {name:'activelist.objectCatalog',type_range:'int',desc:'动态对象分类：1-普通帖子（问答），2-城市圈活动，3-城市圈讨论，4-话题，5-对帖子评论的回复'},
                {name:'activelist.objectTitle',type_range:'string',desc:'动态对象标题(动弹为空 帖子,博客的标题)'},
                {name:'activelist.objectReply.objectName',type_range:'string',desc:'动态对象回复者名称'},
                {name:'activelist.objectReply.objectBody',type_range:'string',desc:'动态对象回复内容'},
                {name:'activelist.url',type_range:'string',desc:'动态对象链接'},
                {name:'activelist.message',type_range:'string',desc:'动态对象内容'},
                {name:'activelist.tweetImage',type_range:'string',desc:'动弹图片，catalog 为 3 时（即为动弹时）才可能存在'},
                {name:'activelist.commentCount',type_range:'int',desc:'评论数'},
                {name:'activelist.pubDate',type_range:'datetime',desc:'发布时间'},
                {name:'notice.replyCount',type_range:'int',desc:'未读评论数'},
                {name:'notice.msgCount',type_range:'int',desc:'未读留言数'},
                {name:'notice.fansCount',type_range:'int',desc:'新增粉丝数'},
                {name:'notice.referCount',type_range:'int',desc:'未读@我数'}
            ]
        };
        $(function(){
            data.result =  $("#"+data.resultType.toLowerCase()).html();
            var html = baidu.template("context",data);
            $('body').after(html);
        });
    </script>
    <script type="text/html" id="context">
        <div class="right">
            <div class="url"><%:=api%>  </div>
            <hr>
            <div class="title"><%:=api%></div>
            <div class="context"><%:=api_desc%></div>
            <div class="title">URL</div>
            <div class="context"><%:=url%></div>
            <div class="title">支持格式</div>
            <div class="context"><%:=dataType%></div>
            <div class="title">HTTP请求方式</div>
            <div class="context"><%:=reqType%></div>
            <div class="title">是否需要登录</div>
            <div class="context"><%:=require_login%></div>
            <div class="title">访问授权限制</div>
            <div class="context"><%:=access_auth%></div>
            <div class="title">请求参数</div>
            <%if(req_param.length>0) { %>
            <div class="return">
                <table  border="1" cellspacing="0" bordercolor="#000000" style="border-collapse:collapse;">
                    <tr>
                        <th width="91px"></th>
                        <th width="33px">必选</th>
                        <th width="67px">类型及范围</th>
                        <th width="531px">说明</th>
                        <th width="66px">默认值</th>
                    </tr>
                    <%for(var i=0;i<req_param.length;i++){%>
                    <tr>
                        <td><%=req_param[i].name%></td>
                        <td><%=req_param[i].must%></td>
                        <td><%=req_param[i].type_range%></td>
                        <td><%=req_param[i].desc%></td>
                        <td><%=req_param[i].default%></td>
                    </tr>
                    <%}%>

                </table>
            </div>
            <%}else{%>
            <div class="context">无</div>
            <%}%>

            <div class="title">注意事项</div>
            <div class="context"><%:=tip%></div>

            <div class="title">返回结果</div>
            <div class="return">
                <div class="returnType"><%=resultType%></div>
                <div class="example">
                    <pre><%:=result%>
                    </pre>
                </div>
                <div class="title">返回字段说明</div>
                <div class="return">
                    <table  border="1" cellspacing="0" bordercolor="#000000" style="border-collapse:collapse;">
                        <tr>
                            <th width="91px">返回值字段</th>
                            <th width="100px">类型及范围</th>
                            <th width="600px">说明</th>
                        </tr>
                        <%for(var i=0;i<ret_param.length;i++){%>
                        <tr>
                            <td><%=ret_param[i].name%></td>
                            <td><%=ret_param[i].type_range%></td>
                            <td><%=ret_param[i].desc%></td>
                        </tr>
                        <%}%>
                    </table>
                </div>
            </div>
        </div>
    </script>
</head>
<body>
    
</body>
</html>